<template>
	<scroll-view scroll-y="true" class="">
		<view v-show="showPlaylist" class="playlist-title">
			<text class="iconfont icon-play"></text>
			<text>全部播放</text>
			<text>(共{{playlist.trackCount}}首)</text>
		</view>
		<view class="playlist">
			<view class="playlist-item" v-for="(item, index) in playlist.tracks" :key="item.id" @click="navPlayer(item.id)">
				<view class="playlist-top">{{index + 1}}</view>
				<view class="playlist-song">
					<view class="">{{item.name}}</view>
					<view class="">
						<image v-if="privileges[index].flag > 60 && privileges[index].flag < 70" src="../../static/dujia.png"></image>
						<image v-if="privileges[index].maxbr == 999000" src="../../static/sq.png"></image>
						{{item.ar[0].name}} - {{item.name}}
 					</view>
				</view>
			</view>
		</view>
	</scroll-view>
</template>

<script>
	import {list} from '../../common/api.js'

	export default {
		
		data() {
			return {
				playlist: {
					trackCount:'',
				},
				privileges: [],
				showPlaylist: false
			}
		},
		onLoad(options){
			let listid = options.listid;
			list(listid).then(res =>{
				if(res.data.code == `200`){
					this.title=res.data.playlist.name
					this.playlist = res.data.playlist
					this.privileges = res.data.privileges
					this.showPlaylist = true
				}
			});
		},
		methods:{
			navPlayer(id){
				uni.navigateTo({
					url:'/pages/player/player?songId='+id,
				});
			}
		}
	}
</script>

<style scoped>
		.playlist-title text:nth-child(1){
			font-size: 34rpx;
		}
		.playlist-title text:nth-child(2){
			font-size: 28rpx;
			margin: 0 25rpx;
		}
		.playlist-title text:nth-child(3){
			font-size: 22rpx;
			color: #b2b2b2;
		}
		.playlist-item{
			display: flex;
			margin: 0 30rpx;
			align-items: center;
		}
		.playlist-top{
			width: 56rpx;
			font-size: 28rpx;
			color: #979797;
			
		}
		.playlist-song {
			margin-top: 20px;
			flex: 1;
			line-height: 40rpx;
		}
		.playlist-song view:nth-child(1) {
			font-size: 30rpx;
			width: 70vw;
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
		}
		.playlist-song view:nth-child(2) {
			font-size: 22rpx;
			color: #a2a2a2;
			width: 70vw;
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
		}
		.playlist-song image {
			width: 34rpx;
			height: 22rpx;
			margin-right: 10rpx;
		}
		
		.playlist-item text {
			font-size: 50rpx;
			color: #c8c8c8;
		}
	
</style>